import urllib.request    #制定url，获取网页数据
from urllib.request import urlretrieve

# import getImage

#第一步;获取页面内容
url = 'https://www.tute.edu.cn/xysh/yxtzsd/1.htm'
request=urllib.request.Request(url)
request.add_header('user-Agent','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36 ')
response = urllib.request.urlopen(request)
html = response.read().decode('utf-8')  #对获取到的网页源码进行解码
print(html)

response=urllib.request.urlopen("https://www.tute.edu.cn/__local/6/F6/65/810526C24A2D78CA7980017F8AC_66F27B38_D79E4.jpg")
img=response.read()
with open('x1.jpg','wb') as f:
    f.write(img)
print("图片x1.jpg存储成功！")
